ActivityOptionsCompat

Helper for accessing features in android.app.ActivityOptions in a backwards compatible fashion.

Types

Link copied to clipboard
Enumeration of background activity start modes.

Properties

Link copied to clipboard
val EXTRA_USAGE_TIME_REPORT: String = "android.activity.usage_time"
A long in the extras delivered by requestUsageTimeReport that contains the total time (in ms) the user spent in the app flow.
Link copied to clipboard
val EXTRA_USAGE_TIME_REPORT_PACKAGES: String = "android.usage_time_packages"
A Bundle in the extras delivered by requestUsageTimeReport that contains detailed information about the time spent in each package associated with the app; each key is a package name, whose value is a long containing the time (in ms).

Functions

Link copied to clipboard
@Nullable
open fun getLaunchBounds(): @Nullable Rect
Returns the bounds that should be used to launch the activity.
Link copied to clipboard
Gets the id of the display where activity should be launched.
Link copied to clipboard
@NonNull
open fun makeBasic(): @NonNull ActivityOptionsCompat
Create a basic ActivityOptions that has no special animation associated with it.
Link copied to clipboard
@NonNull
open fun makeClipRevealAnimation(@NonNull source: @NonNull View, startX: Int, startY: Int, width: Int, height: Int): @NonNull ActivityOptionsCompat
Create an ActivityOptions specifying an animation where the new activity is revealed from a small originating area of the screen to its final full representation.
Link copied to clipboard
@NonNull
open fun makeCustomAnimation(@NonNull context: @NonNull Context, enterResId: Int, exitResId: Int): @NonNull ActivityOptionsCompat
Create an ActivityOptions specifying a custom animation to run when the activity is displayed.
Link copied to clipboard
@NonNull
open fun makeScaleUpAnimation(@NonNull source: @NonNull View, startX: Int, startY: Int, startWidth: Int, startHeight: Int): @NonNull ActivityOptionsCompat
Create an ActivityOptions specifying an animation where the new activity is scaled from a small originating area of the screen to its final full representation.
Link copied to clipboard
@NonNull
open fun makeSceneTransitionAnimation(@NonNull activity: @NonNull Activity, sharedElements: @Nullable Array<Pair<View, String>>): @NonNull ActivityOptionsCompat
@NonNull
open fun makeSceneTransitionAnimation(@NonNull activity: @NonNull Activity, @NonNull sharedElement: @NonNull View, @NonNull sharedElementName: @NonNull String): @NonNull ActivityOptionsCompat
Create an ActivityOptions to transition between Activities using cross-Activity scene animations.
Link copied to clipboard
@NonNull
open fun makeTaskLaunchBehind(): @NonNull ActivityOptionsCompat
If set along with Intent.FLAG_ACTIVITY_NEW_DOCUMENT then the task being launched will not be presented to the user but will instead be only available through the recents task list.
Link copied to clipboard
@NonNull
open fun makeThumbnailScaleUpAnimation(@NonNull source: @NonNull View, @NonNull thumbnail: @NonNull Bitmap, startX: Int, startY: Int): @NonNull ActivityOptionsCompat
Create an ActivityOptions specifying an animation where a thumbnail is scaled from a given position to the new activity window that is being started.
Link copied to clipboard
open fun requestUsageTimeReport(@NonNull receiver: @NonNull PendingIntent)
Ask the the system track that time the user spends in the app being launched, and report it back once done.
Link copied to clipboard
@NonNull
open fun setLaunchBounds(@Nullable screenSpacePixelRect: @Nullable Rect): @NonNull ActivityOptionsCompat
Sets the bounds (window size) that the activity should be launched in.
Link copied to clipboard
@NonNull
open fun setLaunchDisplayId(launchDisplayId: Int): @NonNull ActivityOptionsCompat
Sets the id of the display where the activity should be launched.
Sets the mode for allowing or denying the senders privileges to start background activities to the PendingIntent.
Link copied to clipboard
@NonNull
open fun setShareIdentityEnabled(shareIdentity: Boolean): @NonNull ActivityOptionsCompat
Sets whether the identity of the launching app should be shared with the activity.
Link copied to clipboard
@Nullable
open fun toBundle(): @Nullable Bundle
Returns the created options as a Bundle, which can be passed to startActivity.
Link copied to clipboard
open fun update(@NonNull otherOptions: @NonNull ActivityOptionsCompat)
Update the current values in this ActivityOptions from those supplied in otherOptions.